package example

import (
	"fmt"
	"runtime"
	"sync"
)

func rebase() {

	//runtime.GOMAXPROCS(1)
	runtime.GOMAXPROCS(2)

	var wg sync.WaitGroup
	wg.Add(100)
	for i := 0; i < 100; i++ {
		go func(nu int) {
			defer wg.Done()
			for i := 0; i < 1000; i++ {
				increase()
			}
		}(i)
	}

	wg.Wait()
	fmt.Println(n)
}

var n int32 = 0

func increase() {
	n++
}
